%% Setup
% Information Structure
Info            =   struct();
Info.FixedParam =   struct('RHO_M_ext',0.81,'Taylor_ir',0);
Info.ParamList  =   {'RHO_M_dom','RHO_Y_H',...
                     'Taylor_Pi','Cons_Elas','Fin_AdjCost' ...
                     ...'Cons_ElasTN','Cons_ElasHF'
                     };

Info.ParamNum   =   length(Info.ParamList);

Info.StdVec     =   [1 1 1 -1 -1 60 -10]'*0.01/4;
Info.Mom_Data   =   [1;-1;-0.9;-0.3;...
                     -3/1.2;10/1.2];
Info.Weight     =   [10;10;10;10;...
                     1;1];
% Optimization 
ParaVec_0       =   [0.75;0.75;1.2;3;2.5];               
lb              =   [0.00;0.50;1.1;1;0.01];
ub              =   [0.95;0.95;1.5;10;10];

ObjFunction     =   @(Input)SubFun_Calibration_Eval(PP,SS,MODEL,EquJac,Info,Input);


%% Global Optimization
warning('off','all');

%--------------------------------------------------------------------------
% Particle Swarm
%--------------------------------------------------------------------------
rng default
options             =   optimoptions('particleswarm',...
                                     'Display','iter',...'SwarmSize',100.'HybridFcn',@fmincon,..
                                     'MaxTime',60*60*2,'UseParallel',true);
[ParamVec,fval,exitflag] ...
                    =   particleswarm(ObjFunction,length(lb),lb,ub,options);

[~,Mom_Model]       =   ObjFunction(ParamVec);

save('Result_1_Calibration.mat','Info','Mom_Model','ParamVec');